package protocol.SZ_2021;

import java.util.HashMap;

public class Handle2021SZ91 implements IHandle2021SZ {
    @Override
    public String handle(SZ_2021Cmd cmd) {
        byte subOrder = cmd.subOrder();

        switch (subOrder){
            case 0x02:
                return handle9102(cmd);
            default:
                return "深标:未匹配的命令字"+(cmd.readOrder()+","+cmd.readSubOrder());
        }
    }

    private String handle9102(SZ_2021Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("平台->终端:音视频传输控制");
        builder.append("\r\n");

        builder.append("逻辑通道号:"+cmd.readInt(1));
        builder.append("\r\n");

        HashMap<Integer,String> list = new HashMap<>();
        list.put(0,"关闭音视频传输指令");
        list.put(4,"关闭双向对讲");
        builder.append("控制指令:"+list.getOrDefault(cmd.readInt(1),"未定义"));
        builder.append("\r\n");

        builder.append("关闭音视频类型:"+cmd.readInt(1));
        builder.append("\r\n");

        list.put(0,"子码流");
        list.put(1,"主码流");
        builder.append("码流类型:"+list.getOrDefault(cmd.readInt(1),"未定义"));
        builder.append("\r\n");

        return builder.toString();
    }


}
